package cn.lenchu.core.service;

import cn.lenchu.core.model.GroupDetail;
import cn.lenchu.core.model.GroupItem;
import cn.lenchu.core.model.GroupSummary;

import java.util.List;

/**
 * @author lenchu
 */
public interface GroupService {

    /**
     * 添加或更新Group
     * @param userId userId
     * @param groupId GroupId 添加时不需要此参数
     * @param groupName GroupName
     * @param cash cash
     * @return GroupSummary
     */
    GroupSummary upsertGroup(Integer userId, Integer groupId, String groupName, Double cash);

    /**
     * 列出User的所有Group
     * @param userId userId
     * @return GroupSummary列表
     */
    List<GroupSummary> listUserGroup(Integer userId);

    /**
     * 查询GroupDetail
     * @param groupId groupId
     * @return GroupDetail
     */
    GroupDetail groupDetailById(Integer groupId);

    /**
     * 通过id删除Group
     * @param groupId groupId
     * @return GroupSummary
     */
    GroupDetail deleteGroupById(Integer groupId);

    /**
     * Group里添加Item
     * @param groupId groupId
     * @param code code
     * @param name name
     * @param count count
     * @param price price
     * @param sort sort
     * @return GroupItem
     */
    GroupItem createGroupItem(Integer groupId, String code, String name, Double count, Double price, Integer sort);

    /**
     * 更新Group里的Item
     * @param id ItemId
     * @param count count
     * @param price price
     * @param sort sort
     * @return GroupItem
     */
    GroupItem updateGroupItem(Integer id, Double count, Double price, Integer sort);

    /**
     * 删除Group里的Item
     * @param id ItemId
     * @return GroupItem
     */
    GroupItem deleteGroupItem(Integer id);

    /**
     * 刷新Group
     * @param groupId groupId
     * @return GroupDetail
     */
    GroupDetail refreshGroup(Integer groupId);
}
